UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '36oIVBAe3dOjMjwJJT8ta/c/lUqobVx605Tfxc+kar0=' 
WHERE 
  key_id = 'ff7fafcafa2b2089325edc0dfb467297665eb8ceed9ea3dd7020c26235e6bc9f' 
  AND (
    token = '36oIVBAe3dOjMjwJJT8ta/c/lUqobVx605Tfxc+kar0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026