UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cxh4GuQUrJyGi59KdMjZc6fcmLVkExF7X9Y4atK7FiM='
WHERE
key_id = 'ad3a7968482297164a169d901ceb9c9cfa20cd95094dbe6040d732195a4410d4'
AND (
token = 'cxh4GuQUrJyGi59KdMjZc6fcmLVkExF7X9Y4atK7FiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)