UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iOxtbkyttAOf3SlXC1pfzz2GcppDOasLwfg+BwAu/Cs=' 
WHERE 
  key_id = '1ad0d9afda3a9f52d18ce99c291e8d6fcaf1c640cbe010b2907dace485e96bd8' 
  AND (
    token = 'iOxtbkyttAOf3SlXC1pfzz2GcppDOasLwfg+BwAu/Cs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028