UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4DpRo5W7JDJ2Kbb8XAFcackQhIovPebjcUW3cjjGP0Y='
WHERE
key_id = '96dfa2b5e307582884da44a217452025a93e796b257defea933828e4fbc329f2'
AND (
token = '4DpRo5W7JDJ2Kbb8XAFcackQhIovPebjcUW3cjjGP0Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)