UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uMn77AHj/94EIojj1367YZZOBNmpFyHe8+v9wuigE10=' 
WHERE 
  key_id = 'f5bdf1c43fae871555b70097387d23abbc630ae98fe079d49c53a146d4718e59' 
  AND (
    token = 'uMn77AHj/94EIojj1367YZZOBNmpFyHe8+v9wuigE10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025