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