UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nq1lIKuAKtmE8Cn3qq4e+xrrv6pWZ+5oqJjeBEURUHc='
WHERE
key_id = '57e2b37c9f43010dc870a2be6ddf2f8780d13c6afbc418747cdc3443d56c3cd5'
AND (
token = 'nq1lIKuAKtmE8Cn3qq4e+xrrv6pWZ+5oqJjeBEURUHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)