UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/a1zanHd3pVo/k6qQhPHDGCTjL+8HhTXK8fJAQdpc+0=' 
WHERE 
  key_id = '78a1728dc0879c5a7b59b01ab041fccdc3ea7a5ad3609c9bf9089891c828ebf1' 
  AND (
    token = '/a1zanHd3pVo/k6qQhPHDGCTjL+8HhTXK8fJAQdpc+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035