UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6sDGnzFXJAL6jmf6YlUpn7zdWCD0bQ/C4gsoWUeW3Y='
WHERE
key_id = 'e147d8aec01a08f922d3caa347b3638dedbc5520db27bb718a246da47db1cbee'
AND (
token = 'a6sDGnzFXJAL6jmf6YlUpn7zdWCD0bQ/C4gsoWUeW3Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)