UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nu5SwOKRoooeEFR07/6lzH/BpKqcbxOFw4hd+DAc9Qg=' 
WHERE 
  key_id = 'c17a0dbe205c8e786cbfd11d1e91940ef328af7c30968dcaaac7ab423a6e986f' 
  AND (
    token = 'nu5SwOKRoooeEFR07/6lzH/BpKqcbxOFw4hd+DAc9Qg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035