UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0aXJCkqT6m4B0AKggQ6HR0PRaPOc7+NUC3JD9ifHBlA=' 
WHERE 
  key_id = 'd646b026c4b79c91b65886fcb904f257e6d80430b8331d8151b8236b390ba810' 
  AND (
    token = '0aXJCkqT6m4B0AKggQ6HR0PRaPOc7+NUC3JD9ifHBlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032