UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BAh1LHl2yod7hK9lsKA2KoXNFQ/fOiNbOUfMrJ/3wIY='
WHERE
key_id = 'be423c2544bfca2191f087f57001998259bd4dd2a512e856c12ae29832680016'
AND (
token = 'BAh1LHl2yod7hK9lsKA2KoXNFQ/fOiNbOUfMrJ/3wIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)