UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YZ8s8+Fm0tlgFJWGmsRX90EGcGS0FH4YBVxrkooEswY='
WHERE
key_id = '3191721171a85c3115f9304a8061063c665493baf7c122ce8f0428ac6a9ed60c'
AND (
token = 'YZ8s8+Fm0tlgFJWGmsRX90EGcGS0FH4YBVxrkooEswY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)