UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AShKb5fX0qeeLXnAmyhwW0rTZsJoIyXG9HkehIPTsxo='
WHERE
key_id = '3b8f290f65540c90b410e194eb5c15595ece29d156eeae6fa7659ce00be03d93'
AND (
token = 'AShKb5fX0qeeLXnAmyhwW0rTZsJoIyXG9HkehIPTsxo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)