UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9gX28b2UYila+Adv7XrQLwx4WD2dWMOdynIA6aahC44='
WHERE
key_id = '3b08181ddd4e21f1c6521fee9bb7669f36483df38ebc54a134961d3951f2f26b'
AND (
token = '9gX28b2UYila+Adv7XrQLwx4WD2dWMOdynIA6aahC44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)