UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iNr7SaKBmDtCd2bbZr+Os6kMaq3HXAdoOodlAj+loWI='
WHERE
key_id = '5f587519cbd2a05947110b328aa955d00aae875e6ff5c180729fa588ece16342'
AND (
token = 'iNr7SaKBmDtCd2bbZr+Os6kMaq3HXAdoOodlAj+loWI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)