UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0dsR27FFi9zg3Y2ifoAQCrCLeTEOPg5rIy0EXii2PI8='
WHERE
key_id = '46637ba284df2401871c51a4712fb78d6b78dbfc440d7a4cbc6fc9be5e961f6e'
AND (
token = '0dsR27FFi9zg3Y2ifoAQCrCLeTEOPg5rIy0EXii2PI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)