UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hCH4DWSxyyIzAo3ODxj8NOFLHsEZY6Cb42V1Oxzl0r8='
WHERE
key_id = 'ce02a1427f448fbc258d5b88edf4731dc8cc63d62b63906bcebc7d4c5b01ee2a'
AND (
token = 'hCH4DWSxyyIzAo3ODxj8NOFLHsEZY6Cb42V1Oxzl0r8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)