UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NgoVdHYt0L40e2cwBKQ+ZpXXldtFhT67SxZxV4FC7t4='
WHERE
key_id = 'b5ae04419219b843d7545aeee81e08ea84ba51dd25e2ff480f406670267e8b49'
AND (
token = 'NgoVdHYt0L40e2cwBKQ+ZpXXldtFhT67SxZxV4FC7t4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)