UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1FblWz7aBIAuznCM1bNNM87cYeyMfhYQ1zS9d8eyE1w='
WHERE
key_id = '1311b12438361ff812528355b4e6a8e540ad5cfb6565562299d60359f97fd53e'
AND (
token = '1FblWz7aBIAuznCM1bNNM87cYeyMfhYQ1zS9d8eyE1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)