UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v/3m/lUR9egB0Kdtpo6/taRgOqxd5XEWQEXAy8Yb+tw=' 
WHERE 
  key_id = '6ed450ed12857710cbd2606f333580317c2da8a19353aae8c9585df9fe97fe83' 
  AND (
    token = 'v/3m/lUR9egB0Kdtpo6/taRgOqxd5XEWQEXAy8Yb+tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038