UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NgPxAHHAPTdOwpWGFHD6gpxr3IIcm5tF8Qp7/+zXduA=' 
WHERE 
  key_id = 'b4e713aa138809b4cb0fd65c5295cabb714d079730b9ced1c9392988c74de229' 
  AND (
    token = 'NgPxAHHAPTdOwpWGFHD6gpxr3IIcm5tF8Qp7/+zXduA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00218