UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AXMFR8Nt2cGsteT2yl8M45pQd6QvtcbMdd4lvSVj1AU=' 
WHERE 
  key_id = 'd78ce9adb839d78f636e7df47130b34084f64ac6599c93b36f93d5268bbad990' 
  AND (
    token = 'AXMFR8Nt2cGsteT2yl8M45pQd6QvtcbMdd4lvSVj1AU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035