UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e0woQYYKTW28wj4W9hlzFw23O3S4UZiLP0z3kQxoCVs=' 
WHERE 
  key_id = '16c1f57bcea9784bc112f64aa9bf3d67884e89e98c28b29a85698811713e045a' 
  AND (
    token = 'e0woQYYKTW28wj4W9hlzFw23O3S4UZiLP0z3kQxoCVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020