UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nU40EMDb82gV0Vi1Qunar7lFyw2U4IUO2E0SrzfJKbg=' 
WHERE 
  key_id = '07b998944b4ca323d6fce44b676b78d266ede3768c934f4bab800bd06bd872c9' 
  AND (
    token = 'nU40EMDb82gV0Vi1Qunar7lFyw2U4IUO2E0SrzfJKbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016