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