UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGLWpwzpHSxmk+b8yxYU/Q44lsCpiAdCP7nHevHiUj4=' 
WHERE 
  key_id = '9aee0865ecc3c3746567e2026bb8b5b51c76db779ac84afa709de9246be47730' 
  AND (
    token = 'HGLWpwzpHSxmk+b8yxYU/Q44lsCpiAdCP7nHevHiUj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034