UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lFcBpqBikgFPWJk03prw1JMt5bk6kMPTavHJ+U7vrYU='
WHERE
key_id = '9ed19aacb9017530b2da43c017a124b797612d41820b880e30a0863e7b3e6d03'
AND (
token = 'lFcBpqBikgFPWJk03prw1JMt5bk6kMPTavHJ+U7vrYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)