UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RUpbxuIBUuQWnTJLUQg2r5n9LUPFm1CZACOmrs3H+B4=' 
WHERE 
  key_id = '45f0ab985825846e885c7048c83da3aaa0238730d7e4f004b2896141b1ce0ddf' 
  AND (
    token = 'RUpbxuIBUuQWnTJLUQg2r5n9LUPFm1CZACOmrs3H+B4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041