UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Xzcej+5C+qnx7mD9sBm8qsjzAMpyTasqQ4nvgXLvLw='
WHERE
key_id = '1b8e09a5a495825a56b1f5d6ee1e3ee0c9d83bcbcc0deb82d1f9c8e376308f8e'
AND (
token = '7Xzcej+5C+qnx7mD9sBm8qsjzAMpyTasqQ4nvgXLvLw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)