UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7tsVYr2kemxCS1DYo6ccK30Ig6OHY+x5EPyjJa+ty14='
WHERE
key_id = 'cff13bec84f55d8aa10b22fe2d4a31b72687547881571cc38cb73fc11259ee47'
AND (
token = '7tsVYr2kemxCS1DYo6ccK30Ig6OHY+x5EPyjJa+ty14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)