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