UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wpTNhYC7y8k9tXc13pBRwNelI9RBgqxHMRNZ4ABkCA0='
WHERE
key_id = '3f12a380f9214c69ce3ed53f60ed1c3a51baad39a11acbe230462c91f633d9df'
AND (
token = 'wpTNhYC7y8k9tXc13pBRwNelI9RBgqxHMRNZ4ABkCA0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)