UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1/tHMtdvtsvV52Tr7o5ltkPoAzq26Hhw10Uy0wiLkc8=' 
WHERE 
  key_id = '6007df2c3bef6c2680b4d6cd759fe05603124a48f279231b39577ff1e707238b' 
  AND (
    token = '1/tHMtdvtsvV52Tr7o5ltkPoAzq26Hhw10Uy0wiLkc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043