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