UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8iwo8U0v3JPkacnu6HQvGYW8s5JCwuhltBFzU/JINU8='
WHERE
key_id = 'b4abe094d81d63aa846c1e883363df7707554c73c5f81e347f2e91994540950e'
AND (
token = '8iwo8U0v3JPkacnu6HQvGYW8s5JCwuhltBFzU/JINU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)