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

Query time 0.00035