UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sMD5JLKd3nPAyfLn79SNOS7D8Nv2PfBFO1xN3tt1TPE='
WHERE
key_id = '9910ccc2c771427cd7033265a5a22a9255783334ab2be56cb4203e1f6758cc18'
AND (
token = 'sMD5JLKd3nPAyfLn79SNOS7D8Nv2PfBFO1xN3tt1TPE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)