UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '30Np3AqFovutJCx+2TmQFETlHFwRiwLker4Vu06jcEI=' 
WHERE 
  key_id = '4751f5e0551c48005d7e9702b5505da5ff23f75e72438a5d3b3f42ffeb43087a' 
  AND (
    token = '30Np3AqFovutJCx+2TmQFETlHFwRiwLker4Vu06jcEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043