UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lYvALj6R09Ow8Vh6voVDdknCKqnsvM42jfBAs3tVKH4=' 
WHERE 
  key_id = 'f9848703fb19ec8a699d49fbd52fb1a6216f91a05782a4130e6005a696aebbe1' 
  AND (
    token = 'lYvALj6R09Ow8Vh6voVDdknCKqnsvM42jfBAs3tVKH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032