UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p9I3V/YveUmn940WLJecE9drWSfOSJqqtlxay4nw5so=' 
WHERE 
  key_id = 'a141ddf3345eafbeb5bed87c9afb064b49e308dcbd0e84437e7195945c007b83' 
  AND (
    token = 'p9I3V/YveUmn940WLJecE9drWSfOSJqqtlxay4nw5so=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032