UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xaCyLl85Y7iZoFVedVa4VSQkM756zVqLTgqr/d+VfuY='
WHERE
key_id = 'cfc713776593c1c2ae16149c31c13d3df0aad170c107e38a5a293e3825dc5b9b'
AND (
token = 'xaCyLl85Y7iZoFVedVa4VSQkM756zVqLTgqr/d+VfuY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)