UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pw6rA0rdRcM4dTR9spjqFk3/lsGupe8AeUDUpkETqNU=' 
WHERE 
  key_id = '3419172788e8695edf4838bfce0e24e77e22b7747c785329970948786175f05a' 
  AND (
    token = 'pw6rA0rdRcM4dTR9spjqFk3/lsGupe8AeUDUpkETqNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022